﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using WPFToolsDemo.Windows;
using WPFTools.Dialogs;

namespace WPFToolsDemo
{
    /// <summary>
    /// Windows.xaml 的交互逻辑
    /// </summary>
    public partial class WindowsTest : Window
    {
        public WindowsTest()
        {
            InitializeComponent();
        }

        private void btnBaseWindow_Click(object sender, RoutedEventArgs e)
        {
            BaseWindow b = new BaseWindow();
            b.Show();

            
        }

        private void btnMessageDialog_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result =   WPFTools.Dialogs.MessageDialog.ShowMessage("请输入结果", "标题", MessageBoxButton.YesNoCancel, this);
            MessageBox.Show(result.ToString());
        }

        private void btnWaitingBox_Click(object sender, RoutedEventArgs e)
        {
            WaitingBox.Show(this,
                new Action(
                    () =>
                    {
                        System.Threading.Thread.Sleep(3000);
                    }
                    )
                , "Hello");
        }

        private WaitingBox box;
        private void btnWaitingBox1_Click(object sender, RoutedEventArgs e)
        {
            box = new WaitingBox(
                new Action(
                    () =>
                    {
                        for (int i = 0; i < 100;i++ )
                        {
                            box.ChangeText("已经加载"+i.ToString()+"%");
                            System.Threading.Thread.Sleep(500);
                        }
                    }));

            box.Owner = this;
            box.Text = "测试";
           box.ShowDialog();

        }
    }
}
